import {ref ,computed,} from 'vue'
import { messageData } from '../upload/upload'
export const BarrageData=()=>
{
  const { information } = messageData()
    const barrageArray = ref<string[]>([]);
    const newBarrage =ref('');
    const addBarrage = () => {
        if (newBarrage.value) {
          barrageArray.value.push(newBarrage.value);
          newBarrage.value = '';
        };
      };
      const Adore=()=>
      {
         information.adore=true;
         information.adoreNumber++;
      };
      const disAdore=()=>
      {
         information.adore=false;
         information.adoreNumber--;
      };
      const Collect=()=>
      {
         information.collect=true;
         information.collectNumber++;
      };
      const disCollect=()=>
      {
         information.collect=false;
         information.collectNumber--;
      };
      const Download=()=>
      {
         information.download=true;
         information.downloadNum++;
      };
      const disDownload=()=>
      {
         information.download=false;
         information.downloadNum--;
      };
      const Share=()=>
      {
         information.share=true;
         information.shareNumber++;
      };
      return {
        barrageArray,
        newBarrage,
        addBarrage,
        Adore,
        Collect,
        Download,
        Share,
        disAdore,
        disCollect,
        disDownload,

      };
}